%Generates price impact curves that show $ trade size versus percent (in
%percent, so 1.0 is 1%) for each currency
function fig_price_impact_byTransactionNumber(AlphaVaryingNComposite_SqRt, nVec, optfig)

if optfig.plotfig == 1
    
    % calculate price impact functions
    PriceImpactFunctions = zeros(7,5);
    counter = 0;
    while(counter<5)
        counter = counter+1;
        PriceImpactFunctions(:,counter) = AlphaVaryingNComposite_SqRt{1,counter}(:,2);
    end
    
    [fontname,dimension,lw,folder,color,style,marker,markersize,fontsize_tit,fontsize_ax,fontsize_lab,fontsize_leg] = fn_optfig(optfig);
    
    f0 = figure('Units','inches','Position',dimension);
    
    plot(log(nVec),PriceImpactFunctions(:,1),'Color',color{1},'LineStyle',style{1},'LineWidth',lw); hold on;
    plot(log(nVec),PriceImpactFunctions(:,2),'Color',color{3},'LineStyle',style{2},'LineWidth',lw); hold on;
    plot(log(nVec),PriceImpactFunctions(:,3),'Color',color{4},'LineStyle',style{3},'LineWidth',lw); hold on;
    plot(log(nVec),PriceImpactFunctions(:,4),'Color',color{5},'LineStyle',style{4},'LineWidth',lw); hold on;
    plot(log(nVec),PriceImpactFunctions(:,5),'Color',color{6},'LineStyle',style{5},'LineWidth',lw); hold on;
    xticks(log([1 5 10 50 200 1000 5000]))
    xticklabels({'n = 1','n = 5','n = 10','n = 50','n = 200','n = 1000','n = 5000'})
    title('Price Impact Functions By Number of Transactions', 'interpreter','latex','FontSize',fontsize_tit,'FontName',fontname)
    ylabel('Price Impact (ticks)','interpreter','latex','FontSize',fontsize_ax,'FontName',fontname);
    xlabel('Number of Transactions (n), Log Scale','interpreter','latex','FontSize',fontsize_ax,'FontName',fontname);
    grid; axis tight; box off;
    legendCell = {'AUD', 'GBP', 'CAD', 'EUR', 'JPY'};
    legend(legendCell,'interpreter','latex','FontSize',fontsize_leg,'FontName',fontname,'Location','best')
    legend boxoff
end

name = 'robustness_PriceImpactByTransactionNumber';
print(f0,'-depsc','-painters','-noui','-r600',[folder,name,'.eps'])

end